Repository navigation
Conversation
Connection#close sent CloseSession on every connection and kept a list of status codes to ignore when no catalog was set. Flight SQL leaves the session mechanism to the server, so the driver now sends CloseSession only when it has seen a sign of a session: - the connection set session options, at connect time or later through Connection#setCatalog, or - the server sent a cookie, which is how sessions are typically kept. Connections to servers without sessions no longer make an extra call on close. CloseSession is now best effort, as in the ADBC Flight SQL driver. A failure is logged (at warn when the connection set session options) and does not fail close, since the channel is closed either way and an unclosed session expires on the server. This replaces the list of "no session" status codes. Previously the catalog check only looked at the catalog connection property, so a catalog set with Connection#setCatalog after connecting was treated as if there were no session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Flight SQL leaves the session mechanism to the server ("typically RFC 6265 cookies"), so
Connection#closenow sendsCloseSessiononly when the driver has seen a sign of a session, and never failsclosebecause of it.Connection#close ArrowFlightSqlClientHandler.close closeSession - if this handler does not own the session: return + if this handler does not own the session, or the tracker saw no session: return CloseSession (5s deadline) - on error: ignore UNIMPLEMENTED / INVALID_ARGUMENT / NOT_FOUND / UNAUTHENTICATED - when no catalog property was set, otherwise throw SQLException + on error: log it (warn if session options were set, else debug) and carry on close the gRPC channelA new
ServerSessionTrackerrecords the two signs of a session:This also fixes a gap in the old check: it read only the
catalogconnection property, so a catalog set later withConnection#setCatalogwas treated as "no session".Evidence
ConnectionTest#testCloseOnlyClosesSessionAfterSessionOptionsAreSetconnects to a server that sends no cookie:main, the plain connection already sendsCloseSession:testCloseOnlyClosesSessionAfterSessionOptionsAreSet:692 expected: <0> but was: <1>After: passes.
ArrowFlightSqlClientHandlerTest,ConnectionTestandResultSetTestall pass (109 tests). Handler unit tests cover: no session → no call,setCatalog→ call, cookie → call, unrelated headers → no call, every failure status →closesucceeds, endpoint copies never close the session.Merge Danger
Door: two-way
Reverting restores the previous behaviour; no persisted state or API changes outside the package-private handler constructor.
Blast Radius: connection-close
CloseSession; their sessions expire on the server.CloseSessionafter a catalog was set used to makeclosethrowSQLException; it is now logged at warn.cookieFactoryfield is never registered with the client, sowithRetainCookiesappears to have no effect.🤖 Generated with Claude Code